#include "option.h"
#include "ui_option.h"
#include "mainwindow.h"
#include "audioplayer.h"
#include "QMediaPlayer"
#include "game.h"
Option::Option(MainWindow *m,QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Option),
    game(m)
{
    ui->setupUi(this);

    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground);


    //ui->horizontalSlider->setValue(game->audio->getBgmValue());
    connect(ui->toolButton_3,QAbstractButton::clicked,game,game->return_MainWindow);
}


Option::~Option()
{
    delete ui;
}


void Option::on_horizontalSlider_valueChanged(int value)
{
    //game->audio->setBgmValue(value);
}

void Option::on_toolButton_4_clicked()     //控制音量
{
    ui->stackedWidget->setCurrentIndex(1);
}

void Option::on_toolButton_6_clicked()     //返回选项菜单
{
    ui->stackedWidget->setCurrentIndex(0);
}

void Option::on_toolButton_3_clicked()      //主菜单
{
    this->accept();
}

void Option::on_toolButton_2_clicked()  //重新开始
{
    game->game->loadscene(game->game->id);
    this->accept();
}

void Option::on_toolButton_clicked() //返回游戏
{
    this->accept();
}
